home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Wayzata's Best of Shareware PC/Windows 1
/
Wayzata's Best of Shareware for PC-Windows - Release 1 - Wayzata Technology (1993).iso
/
mac
/
DOS
/
GRAPHICS
/
LISS151
/
LISSAJOU.H
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-20
|
7KB
|
197 lines
/* *****************
LISSAJOU.H
This file contains all the function prototypes and global
variables for LISSAJOU.C
Program originally written by Dan Farmer using algorithms from
Clifford Pickover. Converted from QuickBasic to C by Aaron C. Caba.
See Scientific American January 1991 and Omni February 1990 for
excellent examples by Pickover.
History:
03/09/92 ACC Move #includes and #defines to this file
02/11/92 ACC Major rearangement of all code:
move all field manipulation prototypes to FIELD.C
clean up header files so only necessary stuff is in each
12/18/91 ACC Move all defines, and global var's to DEFINES.H
12/10/91 ACC Move all prototypes, defines, and global var's to
LISSAJOU.H
*/
/*=========================== Defined constants ========================*/
#ifndef _LISSAJOU
#define _LISSAJOU
#define BOLT_HT 255 /* Y pos of GUI bolts in EGA */
#define CLIP_ON 1 /* Clip graphics outside window */
#define CLIP_OFF 0 /* don't clip outside graph. window */
#define PARMFIELDS 10 /* Number of main fields */
#define VIEWER 300 /* for screen preview only (low value="wide angle" perspective) */
#include <alloc.h>
#include <conio.h>
#include <ctype.h>
#include <graphics.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "defines.h" /* constants and enum's */
#include "error_fn.h" /* error handling routine */
/* The following variables are public to all sub-functions in lissajou.c */
char *label[]= { /* Note: label and field_default must be */
" R Value = ", /* declared before the #include "field.h" */
" A Value = ",
" B Value = ",
" X-Exponent = ",
" Y-Exponent = ",
" Z-Exponent = ",
" Sphere Rad = ",
"# of Spheres = ",
"View (X,Y,Z) = ",
"Method (1-5) = ",
"Angle to rotate: ",
"",
"",
"",
"",
};
char *field_default[] = {
"100",
"0.10",
"0.25",
"1",
"1",
"1",
"8",
"500",
"Z",
"1",
"45",
"",
"",
"",
};
/*========================== Global variables ==============================*/
#include "field.h"
struct field_struct field[MAXFIELDS];
int wintop, winbottom, winleft, winright, /* coords of graphics window */
cols, rows, /* max rows and cols on screen */
xcenter, ycenter, /* center of screen */
winxcenter, winycenter, /* center of drawing window */
maxcolors=14, /* number of colors in following array */
colors[]= { /* look-up table of all the */
EGA_DARKGRAY, EGA_YELLOW, /* EGA colors */
EGA_BLUE, EGA_LIGHTBLUE,
EGA_GREEN, EGA_LIGHTGREEN,
EGA_CYAN, EGA_LIGHTCYAN,
EGA_RED, EGA_LIGHTRED,
EGA_MAGENTA, EGA_LIGHTMAGENTA,
EGA_BROWN, EGA_WHITE};
int k, median_index; /* for quicksort() */
float median;
int parm_field; /* is TRUE for fields 1-PARMFIELDS, */
/* FALSE for the others */
/*========================== Function Prototypes =======================*/
/* return (x,y,z) of point at time 't' */
void algo1(int t, int r, float a, float b,
int exponent_x, int exponent_y, int exponent_z,
float *x, float *y, float *z);
void algo2(int t, int r, float a, float b,
int exponent_x, int exponent_y, int exponent_z,
float *x, float *y, float *z);
void algo3(int t, int r, float a, float b,
int exponent_x, int exponent_y, int exponent_z,
float *x, float *y, float *z);
void algo4(int t, int r, float a, float b,
int exponent_x, int exponent_y, int exponent_z,
float *x, float *y, float *z);
void algo5(int t, int r, float a, float b,
int exponent_x, int exponent_y, int exponent_z,
float *x, float *y, float *z);
/* Make sure data is O.K., or assign default if not O.K. */
void check_data(char *data[]);
/* Clean-up the graphics screen, return to text mode */
void clean_up_graph(void);
/* return value of component 'comp' from structure 'a' */
#define component(a,comp) ( (!strcmp(comp,"X")) ? ((a)->x) : \
((!strcmp(comp,"Y")) ? ((a)->y) : ((a)->z)) )
/* draw coordinate axes in the display window */
void disp_axes(char *axis);
/* Draw gui-looking windows, logo, and print field labels */
void disp_bkground(void);
/* display the spheres in the viewing window */
void disp_spheres(struct queue_type queue[], int index[],
int number, char *data[]);
/* Edit the paramaters. Take in array of data.
Return [EXIT | NO_EXIT] */
int edit_parms(char *data[]);
/* Draw a gui looking panel from (wleft,wtop) to (wright,wbottom),
'toggle' lines deep. 'toggle'>0 outset, <0 inset */
void guipanel(int wleft, int wtop, int wright, int wbottom, int toggle);
/* Draw a gui looking bolt at (x,y) with radius 'r',
'toggle' lines deep. 'toggle'>0 for outset, <0 for inset */
void guibolt(int x, int y, int r, int toggle);
/* Initalize the 'field' variable with:
field label
length
screen (x,y) position
type */
void initfield(char *data[]);
/* --- Sort the circles on 'axis', from most distant to closest for simple
"hidden line removal". Farthest will be drawn first and overlapped
by the nearer circles.
Parms: queue = array of values needed sorting.
index = single dimension array of integers indexing queue().
left = lowest index #.
right = highest index #.
*/
void quicksort(struct queue_type queue[], int *index,
const int left, const int right, char *axis);
/* rotate points to get a different viewing angle
Parms: queue = array of values
num = number of spheres to rotate
angle_str = default angle to rotate
r = radius of the spheres
*/
void rotate_fig(struct queue_type queue[], int num,
char *angle_str, char *axis);
/* Scale the radius of the displayed spheres to simulate perspective
Return the scaled radius */
int scaled_radius(int r, int z);
/* Print "msg"+"(Y or N)" on bottom panel
Return TRUE for Y or FALSE for N */
int verify(char *msg);
#endif
/* end-of-file lissajou.h */